package com.tengju.user.domain.model.user;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.time.LocalDateTime;

@Getter
@AllArgsConstructor
public class StarChangeRecord {

    private StarChangeRecordId id;

    private UserIdCode idCode;

    private Integer afterStarRole;

    private Integer afterStarLevel;

    private Integer beforeStarRole;

    private Integer beforeStarLevel;

    private StarChangeTypeEnum changeType;

    private String operBy;

    private String operDesc;

    private LocalDateTime changeTime;


    public StarChangeRecord(UserInfo userInfo, Integer targetStarRole, Integer targetStarLevel, StarChangeTypeEnum changeTypeEnum, Staff staff) {
        this.idCode = userInfo.getIdCode();
        this.afterStarLevel = targetStarLevel;
        this.afterStarRole = targetStarRole;
        this.beforeStarRole = userInfo.getStarRole();
        this.beforeStarLevel = userInfo.getStarLevel();
        this.changeType = changeTypeEnum;
        this.operBy = staff.getName();
        this.changeTime = LocalDateTime.now();
    }
}
